#include <iostream>
#include <string>
using namespace std;

void solve1()
{
    int n; cin >> n;
    string str1, str2;
    cin >> str1 >> str2;
    if (str1.empty() || str2.empty())
    {
        cout << -1;
        return;
    }
    int p1 = -1, p2 = -1;
    string str; int p = 0; int res = 0x3f3f3f3f;
    while (getline(cin, str))
    {
        if (str == str1)
            p1 = p;
        if (str == str2)
            p2 = p;
        if (p1 != -1 && p2 != -1)
            res = min(res, abs(p1 - p2));
        ++p;
    }
    if (p1 != -1 && p2 != -1)
        cout << res;
    else
        cout << -1;
}

void solve2()
{
    int n; cin >> n;
    int pre; cin >> pre;
    int res = 1; --n; int len = 1;
    while (n--)
    {
        int a; cin >> a;
        if (a - pre > 8)
        {
            res = max(res, len);
            len = 1;
        }
        else
        {
            ++len;
        }
        pre = a;
    }
    cout << res;
}

class Solution1 {
public:
    int dx[4] = { 0,0,1,-1 };
    int dy[4] = { 1,-1,0,0 };
    using pii = pair<int, int>;

    int countPath(vector<vector<int> >& CityMap, int n, int m) {
        n = CityMap.size(); m = CityMap[0].size();
        queue<pii> q;
        for (int i = 0; i < n; ++i)
            for (int j = 0; j < m; ++j)
                if (CityMap[i][j] == 1)
                {
                    q.push({ i,j });
                    break;
                }

        int res = 0;
        while (!q.empty())
        {
            int sz = q.size(); bool rflag = false;
            while (sz--)
            {
                pii p = q.front(); q.pop();
                int cx = p.first; int cy = p.second;
                CityMap[cx][cy] = 1;
                for (int k = 0; k < 4; ++k)
                {
                    int x = cx + dx[k]; int y = cy + dy[k];
                    if (x >= 0 && x < n && y >= 0 && y < m && CityMap[x][y] != 1)
                    {
                        if (CityMap[x][y] == 2)
                        {
                            res++;
                            rflag = true;
                        }
                        if (CityMap[x][y] == 0)
                        {
                            q.push({ x,y });
                        }
                    }
                }
            }
            if (rflag) break;
        }
        return res;
    }
};

class Solution2 {
public:
    int incremovableSubarrayCount(vector<int>& nums) {
        int n = nums.size();
        int res = 0;
        int l = 1;
        while (l < n && nums[l - 1] < nums[l]) {
            l++;
        }
        res += l + (l < n);
        for (int r = n - 2; r >= 0; r--) {
            while (l > 0 && nums[l - 1] >= nums[r + 1]) {
                l--;
            }
            res += l + (l <= r);
            if (nums[r] >= nums[r + 1]) {
                break;
            }
        }
        return res;
    }
};




int main()

    return 0;
}